home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 July
/
EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso
/
earcd
/
dev
/
amos
/
moreusel.lha
/
GlenzCubeVec.AMOS
/
GlenzCubeVec.amosSourceCode
Wrap
AMOS Source Code
|
1997-04-18
|
3KB
|
134 lines
' *************************************
' * *
' * Glenz Cube Vec V1.3 *
' * Written by Chris Hodges *
' * *
' *************************************
'
Gosub INITSCREEN
Gosub INITPOINTS
WX=0 : WY=0 : WZ=0
S=0 : GLENZ=0
Screen 1
Gosub CALCCOORDS
Do
If Inkey$=" " Then GLENZ=1-GLENZ
Gosub DRAOBJ
Screen Swap 0
Gosub CALCCOORDS
S=1-S
Wait Vbl
Loop
End
INITPOINTS:
Read ANZP
Dim PT(ANZP,2),CM(ANZP,1)
For A=1 To ANZP
Read PT(A,0),PT(A,1),PT(A,2)
Next
Read ANZL
Dim LC(ANZL)
For A=1 To ANZL
Read LC(A)
Next
Dim DB(6,3,1)
For A=0 To(ANZL/4)-1
DB(A,0,0)=319 : DB(A,1,0)=255 : DB(A,2,0)=0 : DB(A,3,0)=0
DB(A,0,1)=319 : DB(A,1,1)=255 : DB(A,2,1)=0 : DB(A,3,1)=0
Next
Return
INITSCREEN:
Screen Open 1,320,256,2,0 : Screen Hide
Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
Screen Open 0,320,256,64,0 : Screen To Front 1
Curs Off : Flash Off : Paper 0 : Pen 63 : Cls 0
Centre "Press Space to toggle Glenz"
Dim LG(5)
For A=0 To 5 : LG(A)=Logbase(A) : Next
Dim CL(4)
CL(0)=-$411 : CL(1)=-$141 : CL(2)=-$114 : CL(3)=$22 : CL(4)=$220
For A=0 To 31
C=$AAA
For B=0 To 4
If Extension_8_04F8(B) and A Then C= Extension_8_0EE8(C,CL(B),$0 To $FFF)
Next
Colour A,C
Next
Double Buffer
Autoback 0
Return
CALCCOORDS:
Extension_8_1122 Extension_8_1106(WZ,250), Extension_8_1106(WY,250),2100+ Extension_8_1106(WX,1900)
Add WX,9
Add WY,10
Add WZ,11
Extension_8_1138 WX,WY,WZ
Extension_8_1152
For A=1 To ANZP
CM(A,0)= Extension_8_1168(PT(A,0),PT(A,1),PT(A,2))+160
CM(A,1)= Extension_8_1184 +128
Next
Return
DRAOBJ:
BP=0
For A=1 To ANZL Step 4
MX1=319 : MY1=255 : MX2=0 : MY2=0
X1=CM(LC(A),0) : Y1=CM(LC(A),1)
X2=CM(LC(A+1),0) : Y2=CM(LC(A+1),1)
X3=CM(LC(A+2),0) : Y3=CM(LC(A+2),1)
If GLENZ=0
C=(X3-X1)*(Y2-Y1)-(X2-X1)*(Y3-Y1)
Else
C=-1
End If
If C<0
Extension_8_1016 X1,Y1 To X2,Y2,1,-1
X4=CM(LC(A+3),0) : Y4=CM(LC(A+3),1)
Extension_8_1016 X2,Y2 To X3,Y3,1,-1
MX1=Max(Min(Min(Min(Min(Min(X1,MX1),X2),X3),X4),319),0)
MY1=Max(Min(Min(Min(Min(Min(Y1,MY1),Y2),Y3),Y4),255),0)
Extension_8_1016 X3,Y3 To X4,Y4,1,-1
MX2=Min(Max(Max(Max(Max(Max(X1,MX2),X2),X3),X4),0),319)
MY2=Min(Max(Max(Max(Max(Max(Y1,MY2),Y2),Y3),Y4),0),255)
Extension_8_1016 X4,Y4 To X1,Y1,1,-1
BX1=Min(MX1,DB(BP,0,S)) : BY1=Min(MY1,DB(BP,1,S))
BX2=Max(MX2,DB(BP,2,S)) : BY2=Max(MY2,DB(BP,3,S))
If BX2>BX1 and BY2>BY1
Extension_8_1042 1,0,BX1,BY1,BX2+1,BY2+1 To 0,BP
End If
DB(BP,0,S)=MX1 : DB(BP,1,S)=MY1 : DB(BP,2,S)=MX2 : DB(BP,3,S)=MY2
If MX2>MX1 and MY2>MY1
Extension_8_121C 1,0,MX1,MY1 To MX2+1,MY2+1
End If
Else
If DB(BP,2,S)>DB(BP,0,S) and DB(BP,3,S)>DB(BP,1,S)
Extension_8_121C 0,BP,DB(BP,0,S),DB(BP,1,S) To DB(BP,2,S)+1,DB(BP,3,S)+1
End If
DB(BP,0,S)=319 : DB(BP,1,S)=255 : DB(BP,2,S)=0 : DB(BP,3,S)=0
End If
Inc BP
Next
Return
' 1_____2
' 5/____/|
' | | |6|
' |4|__|_|3
' |/___|/
' 8 7
Data 8
Data -100,-100,-100
Data 100,-100,-100
Data 100,-100,100
Data -100,-100,100
Data -100,100,-100
Data 100,100,-100
Data 100,100,100
Data -100,100,100
' Axi
Data 6*4
Data 1,2,6,5
Data 4,3,2,1
Data 2,3,7,6
Data 3,4,8,7
Data 4,1,5,8
Data 6,7,8,5